/*
 *  Copyright (C) 2010 Glauco
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.balisunrise.common;

import org.balisunrise.common.listeners.TransactionListener;

/**
 * Transação de uma entidade. Possui uma representação visual com um painel
 * de ações para transação, além do possuir e mostrar o Editor e o Search.
 *
 * As ações de Confirm e Cancel do Editor e do Search da Trasaction são 
 * implementados pelo painel de ações e não serão incluidos ações de Confirm
 * e Cancel dos mapas de eventos.
 *
 * @author Glauco
 * @version 1.0
 * @param <S> Search
 * @param <E> Editor
 * @param <A> TransactionAction
 * @param <V> Representação Visual da Transação.
 */
public interface Transaction <S extends Search, E extends Editor,
        A extends TransactionActions, V> extends VisualEntity<V> {

    /**
     * Retorna o objeto de Editor da Transaction.
     */
    public E getEditor();

    /**
     * Retorna o objeto de Search da Transaction.
     */
    public S getSearch();

    /**
     * Retorna o objeto de TransactionAction da Transaction
     */
    public A getTransactionAction();

    /**
     * Mostra a representação visual de Editor da Trasaction.
     */
    public void showEditor();

    /**
     * Mostra a representação visual de Search da Trasaction.
     */
    public void showSearch();

    /**
     * Adiciona um listener.
     *
     * @param listener the listener to be added.
     */
    public void addTransactionListener(TransactionListener listener);

    /**
     * Remove um listener.
     *
     * @param listener the listener to be removed.
     * @return true if the listener was removed, false if the listener was not
     * included.
     */
    public boolean removeTrasactionListener(TransactionListener listener);

    /**
     * Retorna um array com os listeners.
     *
     * @return
     */
    public TransactionListener[] getTransactionListeners();

}